const express = require("express");
const path = require("path");

let app = express();

app.get("/",(req,res)=>{
    // 加载index.html页面
    res.sendFile(path.join(__dirname,"./views/index.html"));
})

app.get("/checkusername",(req,res)=>{
  let {username} = req.query;
  if(username=="张三"){
    let obj = {
        info:"用户名正确",
        status:1
    };
    // res.send();
    res.json(obj)
}else{
    let obj = {
        info:"用户名错误",
        status:0
    };
    //res.send("用户名错误");
    res.json(obj)
    }
})

app.listen(8989)